API Documentation
String.h
1 // String.h
3 //
5 
6 namespace nkMemory
7 {
21  class String final
22  {
23  public :
24 
29  String () noexcept ;
36  String (const char* data) noexcept ;
43  String (unsigned long long size) noexcept ;
52  String (const char* data, unsigned long long size) noexcept ;
59  String (const StringView& view) noexcept ;
65  String (const String& other) noexcept ;
71  String (String&& other) noexcept ;
75  ~String () noexcept ;
76 
77  // Getters
81  char* getData () const ;
85  unsigned long long getSize () const ;
89  bool empty () const ;
93  char& front () ;
97  char& back () ;
98 
99  // Management
103  void clear () ;
110  void resize (unsigned long long size) ;
111 
112  // Utils
120 
121  // Operators
127  String& operator= (const char* data) ;
133  String& operator= (const StringView& other) ;
139  String& operator= (const String& other) ;
145  String& operator= (String&& other) noexcept ;
151  const char operator[] (unsigned long long index) const ;
157  char& operator[] (unsigned long long index) ;
163  void operator+= (char value) ;
169  void operator+= (const StringView& other) ;
176  String operator+ (char c) const ;
183  String operator+ (const char* other) const ;
190  String operator+ (const StringView& other) ;
197  bool operator== (const char* other) const ;
204  bool operator== (const StringView& other) const ;
211  bool operator!= (const char* other) const ;
218  bool operator!= (const StringView& other) const ;
219 
220  public :
221 
222  // Inlined constructors
229  template<typename T = std::string>
230  String (const std::string& str) noexcept ;
237  template<typename T = std::string_view>
238  String (const std::string_view& str) noexcept ;
239 
240  public :
241 
242  // Inlined operators
246  operator std::string () const ;
250  operator std::string_view () const ;
254  operator nkLog::String () const ;
258  operator nkLog::StringView () const ;
259 
266  StringView& operator= (const std::string& data) ;
273  StringView& operator= (const std::string_view& data) ;
274  } ;
275 
283  inline bool operator== (const char* c, const nkMemory::String& str) ;
284 
292  inline nkMemory::String operator+ (char c, const nkMemory::String& str) ;
300  inline nkMemory::String operator+ (const char* c, const nkMemory::String& str) ;
301 }
nkMemory::String::back
char & back()
nkMemory::String::front
char & front()
nkMemory::String::split
BufferCast< StringView > split(StringView separator)
nkMemory::String::empty
bool empty() const
nkLog
Encompasses all API of component NilkinsLog.
Definition: StringView.h:7
nkMemory::String
Class holding information about a string, with ownership over the data.
Definition: String.h:22
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkMemory::String::String
String() noexcept
nkMemory::BufferCast
Holds a Buffer and make it easy to cast the binary data.
Definition: BufferCast.h:18
nkMemory::String::clear
void clear()
nkMemory::String::getData
char * getData() const
nkMemory::String::resize
void resize(unsigned long long size)
nkMemory::String::getSize
unsigned long long getSize() const
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7